<<<<<<< HEAD
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Guard extends MY_Controller {
	
	function __construct(){
		parent::__construct();
		exit;
		
		/** 登陆验证 */
		$user = $this->session->userdata('rsh_user');
		if(!isset($user['user_id']) || !$user['user_id']){
			$str = $_SERVER['REQUEST_URI'];
			header('Location: /login.html');
			exit;
		}
		
		$this->tab = 'user';
		$this->sub = 'guard';
	}
	
	//站岗理财产品
	function index(){
		
		//接收参数
		if($this->session->userdata('rsh_user') == false){//如果未登录就跳到登录页面
			echo '请先登录';
			return;
		}
		
		$user = $this->session->userdata('rsh_user');
		$this->load->model('Account_model');
		$user_account = $this->Account_model->get_account($user['user_id']);
		
		$vdata['account'] = $user_account;
		$vdata['title'] = '活利宝 - '.CON_KEYWORDS;
		$this->load->view('borrow/guard', $vdata);	
	}
	
	function doturninto(){
		
		$money = $_POST['money'];
		
		
		$user = $this->session->userdata('rsh_user');
		$this->load->model('User_model');
		
		$this->load->model('Account_model');
		$user_account = $this->Account_model->get_account($user['user_id']);
		if($money > $user_account['use_money']){
			echo "输入金额大于可转入金额";
			return;
		}
		
		$data['user_id'] = $user['user_id'];
		$data['money'] = $money;
		$data['apr'] = '4.5';
		$data['add_time'] = time();
		$data['ftype'] = 1;
		$data['remark'] = '单笔转入';
		$data['addip'] = $this->js->get_ip();
		$this->load->model('Guard_model');
		$flag = $this->Guard_model->invest($data);
		if($flag == 1){
			echo 1;	
		}else{
			echo "转入失败";	
		}
			
	}
	
	function doturnout(){
		$money = $_POST['money'];
		
		$user = $this->session->userdata('rsh_user');
		$this->load->model('Account_model');
		$user_account = $this->Account_model->get_account($user['user_id']);
		if($money > $user_account['use_money']){
			echo "输入金额大于可转入金额";
			return;
		}
		
		$data['user_id'] = $user['user_id'];
		$data['money'] = $money;
		$data['apr'] = '4.5';
		$data['add_time'] = time();
		$data['ftype'] = 2;
		$data['remark'] = '转出到平台';
		$data['addip'] = $this->js->get_ip();
		$this->load->model('Guard_model');
		
		$flag = $this->Guard_model->repayment($data);
		
		if($flag == 1){
			echo 1;	
		}else{
			echo "转入失败";	
		}
	}
	
	//站岗用户中心
	function woodneybao(){
		
		$data['per_page'] = intval($this->input->get('per_page'));
		$data['page_size'] = 20;
		
		$direction = $this->input->get('direction')?trim($this->input->get('direction')):'income';
		
		$vdata = $this->get_user_info('user_woodneybao','woodneybao');
		$this->load->model('Guard_model');
		
		$user = $this->session->userdata('rsh_user');
		$data['user_id'] = $user['user_id'];
		
		$total = $this->Guard_model->total_guard($data);
		
		$vdata['account'] = $total['into_money_count']- $total['out_money_count']+$total['log_money_count'];
		$vdata['interest'] = $total['log_money_count'];
		
		if($direction == 'out'){
			$data['ftype'] = 2;
			$data['fstatus'] = 1;
			$out_list = $this->Guard_model->get_guard_into_list($data);
			$vdata['list'] = $out_list['list'];
		}else if($direction == 'in'){
			$data['ftype'] = 1;
			$data['fstatus'] = 1;
			$into_list = $this->Guard_model->get_guard_into_list($data);
			$vdata['list'] = $into_list['list'];
		}else{
			$earnings_list = $this->Guard_model->get_guard_log_list($data);
			$vdata['list'] = $earnings_list['list'];
		}
		
		
		$this->load->library('pagination');
		$config['base_url'] = '/guard/woodneybao.html?direction='.$direction;
		$config['total_rows'] = $vdata['count'];
		$config['per_page'] = 20;
		$config['first_link'] = '首页';
		$config['next_link'] = '下一页';
		$config['prev_link'] = '上一页';
		$config['last_link'] = '尾页';
		$this->pagination->initialize($config);
		
		
		
		$vdata['direction'] = $direction;
		
		$vdata['title'] = '活利宝 - '.CON_KEYWORDS;
		$this->load->view('user/guard_woodneybao', $vdata);
	}
	
	//转入
	function turninto(){
		$vdata = $this->get_user_info('user_woodneybao','woodneybao');
		$user = $this->session->userdata('rsh_user');
		$this->load->model('Account_model');
		$user_account = $this->Account_model->get_account($user['user_id']);
		
		$vdata['account'] = $user_account;
		
		$vdata['title'] = '活利宝 - '.CON_KEYWORDS;
		$this->load->view('user/guard_turninto', $vdata);
	}
	
	
	//转出
	function turnout(){
		$vdata = $this->get_user_info('user_woodneybao','woodneybao');
		$user = $this->session->userdata('rsh_user');
		
		$this->load->model('Guard_model');
		$total = $this->Guard_model->total_guard($data);
		$vdata['account'] = $total['into_money_count']- $total['out_money_count'];
		
		$vdata['title'] = '活利宝 - '.CON_KEYWORDS;
		$this->load->view('user/guard_turnout', $vdata);
	}
	
}
	
	
=======
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Guard extends MY_Controller {
    
	function __construct(){
		parent::__construct();
		exit;
		
		/** 登陆验证 */
		$user = $this->session->userdata('rsh_user');
		if(!isset($user['user_id']) || !$user['user_id']){
			$str = $_SERVER['REQUEST_URI'];
			header('Location: /login.html');
			exit;
		}
		
		$this->tab = 'user';
		$this->sub = 'guard';
	}
	
	//站岗理财产品
	function index(){
		
		//接收参数
		if($this->session->userdata('rsh_user') == false){//如果未登录就跳到登录页面
			echo '请先登录';
			return;
		}
		
		$user = $this->session->userdata('rsh_user');
		$this->load->model('Account_model');
		$user_account = $this->Account_model->get_account($user['user_id']);
		
		$vdata['account'] = $user_account;
		$vdata['title'] = '活利宝 - '.CON_KEYWORDS;
		$this->load->view('borrow/guard', $vdata);	
	}
	
	function doturninto(){
		
		$money = $_POST['money'];
		
		
		$user = $this->session->userdata('rsh_user');
		$this->load->model('User_model');
		
		$this->load->model('Account_model');
		$user_account = $this->Account_model->get_account($user['user_id']);
		if($money > $user_account['use_money']){
			echo "输入金额大于可转入金额";
			return;
		}
		
		$data['user_id'] = $user['user_id'];
		$data['money'] = $money;
		$data['apr'] = '4.5';
		$data['add_time'] = time();
		$data['ftype'] = 1;
		$data['remark'] = '单笔转入';
		$data['addip'] = $this->js->get_ip();
		$this->load->model('Guard_model');
		$flag = $this->Guard_model->invest($data);
		if($flag == 1){
			echo 1;	
		}else{
			echo "转入失败";	
		}
			
	}
	
	function doturnout(){
		$money = $_POST['money'];
		
		$user = $this->session->userdata('rsh_user');
		$this->load->model('Account_model');
		$user_account = $this->Account_model->get_account($user['user_id']);
		if($money > $user_account['use_money']){
			echo "输入金额大于可转入金额";
			return;
		}
		
		$data['user_id'] = $user['user_id'];
		$data['money'] = $money;
		$data['apr'] = '4.5';
		$data['add_time'] = time();
		$data['ftype'] = 2;
		$data['remark'] = '转出到平台';
		$data['addip'] = $this->js->get_ip();
		$this->load->model('Guard_model');
		
		$flag = $this->Guard_model->repayment($data);
		
		if($flag == 1){
			echo 1;	
		}else{
			echo "转入失败";	
		}
	}
	
	//站岗用户中心
	function woodneybao(){
		
		$data['per_page'] = intval($this->input->get('per_page'));
		$data['page_size'] = 20;
		
		$direction = $this->input->get('direction')?trim($this->input->get('direction')):'income';
		
		$vdata = $this->get_user_info('user_woodneybao','woodneybao');
		$this->load->model('Guard_model');
		
		$user = $this->session->userdata('rsh_user');
		$data['user_id'] = $user['user_id'];
		
		$total = $this->Guard_model->total_guard($data);
		
		$vdata['account'] = $total['into_money_count']- $total['out_money_count']+$total['log_money_count'];
		$vdata['interest'] = $total['log_money_count'];
		
		if($direction == 'out'){
			$data['ftype'] = 2;
			$data['fstatus'] = 1;
			$out_list = $this->Guard_model->get_guard_into_list($data);
			$vdata['list'] = $out_list['list'];
		}else if($direction == 'in'){
			$data['ftype'] = 1;
			$data['fstatus'] = 1;
			$into_list = $this->Guard_model->get_guard_into_list($data);
			$vdata['list'] = $into_list['list'];
		}else{
			$earnings_list = $this->Guard_model->get_guard_log_list($data);
			$vdata['list'] = $earnings_list['list'];
		}
		
		
		$this->load->library('pagination');
		$config['base_url'] = '/guard/woodneybao.html?direction='.$direction;
		$config['total_rows'] = $vdata['count'];
		$config['per_page'] = 20;
		$config['first_link'] = '首页';
		$config['next_link'] = '下一页';
		$config['prev_link'] = '上一页';
		$config['last_link'] = '尾页';
		$this->pagination->initialize($config);
		
		
		
		$vdata['direction'] = $direction;
		
		$vdata['title'] = '活利宝 - '.CON_KEYWORDS;
		$this->load->view('user/guard_woodneybao', $vdata);
	}
	
	//转入
	function turninto(){
		$vdata = $this->get_user_info('user_woodneybao','woodneybao');
		$user = $this->session->userdata('rsh_user');
		$this->load->model('Account_model');
		$user_account = $this->Account_model->get_account($user['user_id']);
		
		$vdata['account'] = $user_account;
		
		$vdata['title'] = '活利宝 - '.CON_KEYWORDS;
		$this->load->view('user/guard_turninto', $vdata);
	}
	
	
	//转出
	function turnout(){
		$vdata = $this->get_user_info('user_woodneybao','woodneybao');
		$user = $this->session->userdata('rsh_user');
		
		$this->load->model('Guard_model');
		$total = $this->Guard_model->total_guard($data);
		$vdata['account'] = $total['into_money_count']- $total['out_money_count'];
		
		$vdata['title'] = '活利宝 - '.CON_KEYWORDS;
		$this->load->view('user/guard_turnout', $vdata);
	}
	
}
	
	
>>>>>>> d47623b610d79a4eeb489500830c00d70933f414
?>